package statusPattern;

import javafx.scene.paint.Stop;

/**
 * 环境类，用于维护当前状态，定义状态字典
 */
public class Context {

    // 定义所有状态字典
    public final static OpenningState openingState = new OpenningState();
    public final static RunningState runningState = new RunningState();
    public final static CloseingState closeingState = new CloseingState();
    public final static StopingState stopingState = new StopingState();

    // 存储和维护状态
    private LiftState liftState;

    public void setLiftState(LiftState liftState) {
        this.liftState = liftState;
        this.liftState.setContext(this);
    }

    public LiftState getLiftState() {
        return liftState;
    }

    public void open(){
        this.liftState.open();
    }

    public void close(){
        this.liftState.close();
    }

    public void stop(){
        this.liftState.stop();
    }

    public void run(){
        this.liftState.run();
    }


}
